package helper;

import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;

import android.os.AsyncTask;

public abstract class GetMyScheduleHelper extends AsyncTask<String, Void, String> {
	
	@Override
	protected String doInBackground(String... params) {
		String respJsonStr = null;
		
		try {
			JSONObject jsonObj = new JSONObject();
			HttpResponse resp;
			
			jsonObj.put("id", params[0]);
			resp = HttpHelper.executePost(
					"http://iculture.twgg.org/schedule/getMySchedule.php", jsonObj.toString());
			respJsonStr = EntityUtils.toString(resp.getEntity());
		} catch (JSONException e) {
			e.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return respJsonStr;
	}
	
	@Override
	protected abstract void onPostExecute(String jsonString);
}